﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;

using Serilog;

namespace Tszy.Unlimited.AspNetCore.Extensions;

internal static class UseSerilogExtensions
{
    public static void RegisterSerilog(this WebApplicationBuilder builder, IConfiguration configuration)
    {
        // 配置 UseSerilog 组件。 
        builder.Host.UseSerilog(Log.Logger, dispose: true);
    }

    public static void UseSerilog(this WebApplication app)
    {
        // 配置请求日志。
        app.UseSerilogRequestLogging();
    }
}